<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="content-style-type" content="text/css" />
</head>
<body>
<?php	
require_once("../classes/database.php"); 
require_once("../functions/functions.php"); 
require_once("../classes/generate_form.php"); 
require_once('../classes/html_cleanup.php');
include "function.php"; 
include "simple_html_dom.php"; 

$pic_id     = getValue('pic_id',"str","POST");
$pic_name   = getValue('pic_name',"str","POST");
$pic_data   = getValue('pic_data',"str","POST");
$pic_path   = getValue('pic_path',"str","POST");
$pic_path1  = "../sondv/" . $pic_path;
$pic_path2  = "../sondv/" . str_replace($pic_name,"",$pic_path);
$code       = getValue('code',"str","POST");
echo "<br/>";
echo $pic_path2;
echo "<br/>";
echo $pic_id;
echo "<br/>";
$code2   = md5($pic_name . "sondvhoc" . date("z") . $pic_id);
if($code == $code2){
   echo "ok roi";
   echo "<br/>";
   if(!is_dir($pic_path2)){
      mkdir($pic_path2,0777, true);
      chmod($pic_path2, 0777);
   }   
   if (move_uploaded_file($_FILES["pic_data"]["tmp_name"], $pic_path1)) {
        echo "The file ". basename( $_FILES["pic_data"]["name"]). " has been uploaded.";
    } else {
        echo "Sorry, there was an error uploading your file.";
    }   
   
}else{
   echo "da sai roi";
}

?> 
</body>
</html>  
